<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Aloha Editor command strikethrough tests</title>
	<!-- include qunit -->
	<link rel="stylesheet" href="../../vendor/qunit.css" type="text/css"/>

	<script type="text/javascript" src="../../vendor/qunit.js"></script>

	<script src="../../../lib/require.js" ></script>
	<!-- include jquery -->
	<script	src="../../../lib/vendor/jquery-3.7.0.js" ></script>
	<script type="text/javascript" src="../../vendor/jquery.simulate.js"></script>
	<script>
        require.config({
		    baseUrl: "../"
        });
		var Aloha = {
			settings: {
				jQuery: $,
				baseUrl: '../../../lib'
			}
		};
	</script>

	<!-- include aloha -->
	<script src="../../../lib/aloha.js" ></script>

	<script>
		// load command test suite
		require( ['commandtest'] );
	</script>
	<style type="text/css">
		.aloha-editable ol li { list-style-type: decimal; margin: 1.5em; }
		.aloha-editable ol li ol li{ list-style-type: decimal; margin: 2em; }
	</style>
	<link rel="stylesheet" href="../commandtest.css" type="text/css"/>
</head>
<body>
	<!-- include the tests -->
	<script>
	var tests = {
			defaultValue: '',
			defaultCommand: 'strikethrough',
			defaultAttributes: [ ],
			tests: [		        
					{  	start: 'fo[o<s>b]ar</s>baz',
					   	indetermResult: true,
					   	stateResult: false
					},
					{  	start: 'foo<s>ba[r</s>b]az',
					   	indetermResult: true,
					   	stateResult: false
					},
					{  	start: 'fo[o<s>bar</s>b]az',
					   	indetermResult: true,
					   	stateResult: false
					},
					{  	start: 'foo[<s>b]ar</s>baz',
					   	indetermResult: false,
					   	stateResult: true
					},
					{  	start: 'foo<s>ba[r</s>]baz',
					   	indetermResult: false,
					   	stateResult: true
					},
					{  	start: 'foo[<s>bar</s>]baz',
					   	indetermResult: false,
					   	stateResult: true
					},
					{  	start: 'foo<s>[bar]</s>baz',
					   	indetermResult: false,
					   	stateResult: true
					},
					{  	start: 'foo{<s>bar</s>}baz',
					   	indetermResult: false,
					   	stateResult: true
					},
					{  	start: 'fo[o<span style=text-decoration:line-through>b]ar</span>baz',
					   	indetermResult: true,
					   	stateResult: false
					},
					{  	start: 'foo[bar]baz',
              execResult: 'foo<s>[bar]</s>baz'
          },
          {  	start: 'foo<s>[bar]</s>baz',
              execResult: 'foo[bar]baz'
          },
					{  	start: 'foo<s>[bar</s>]baz',
              execResult: 'foo[bar]baz' 
          },
					{  	start: 'foo<s>b[ar</s>]baz',
              execResult: 'foo<s>b</s>[ar]baz' 
          },
					{  	start: 'foo<s>bar[</s>b]az',
              execResult: 'foo<s>bar[b]</s>az'
          },
					{  	start: 'foo<s>bar[</s>b]az',
              execResult: 'foo<s>bar[b]</s>az' 
          },
					{  	start: 'foo[]bar',
              execResult: 'foo[]bar' 
          },
					{  	start: '<s>foo[]bar</s>',
              execResult: '<s>foo[]bar</s>' 
          },
          {   exclude: ['webkit', 'msie7.0', 'msie8.0'],	
					  	start: '<span>foo</span>{}<span>bar</span>',
              execResult: '<span>foo</span>{}<span>bar</span>' 
          },
          {   include: ['webkit', 'msie7.0', 'msie8.0'],	
					  	start: '<span>foo</span>{}<span>bar</span>',
              execResult: '<span>foo[]</span><span>bar</span>' 
          },
          // Note: Following test also fails to run on IE9.
          {   exclude: ['webkit', 'msie'], 	
					  	start: '<span>foo[</span><span>]bar</span>',
              execResult: '<span>foo[</span><span>]bar</span>' 
          },
          {   include: ['webkit'], 	
					  	start: '<span>foo[</span><span>]bar</span>',
              execResult: '<span>foo[]</span><span>bar</span>' 
          },
					{  	start: 'foo[bar<b>bam]baz</b>',
              execResult: 'foo<s>[bar</s><b><s>bam]</s>baz</b>' 
          },
          {   exclude: ['msie7.0', 'msie8.0'],	
              start: '<table><tbody><tr><td>foo<td>b[a]r<td>baz</table>',
					   	execResult: '<table><tbody><tr><td>foo<td>b<s>[a]</s>r<td>baz</table>' 
					},
          {   exclude: ['mozilla', 'msie'],	
					  	start: '<table><tbody><tr data-start=1 data-end=2><td>foo<td>bar<td>baz</table>',
					   	execResult: '<table><tbody><tr><td>foo<td><s>[bar</s><td>}baz</table>' 
					},
          {   exclude: ['mozilla', 'msie'],	
					  	start: '<table><tbody><tr data-start=0 data-end=2><td>foo<td>bar<td>baz</table>',
					   	execResult: '<table><tbody><tr><td><s>[foo</s><td><s>bar</s><td>}baz</table>' 
					},
					{  	exclude: ['mozilla', 'msie'],	
					  	start: '<table><tbody data-start=0 data-end=1><tr><td>foo<td>bar<td>baz</table>',
					   	execResult: '<table><tbody><tr><td><s>[foo</s><td><s>bar</s><td><s>baz</s></table>}' 
					},
					{  	exclude: ['mozilla', 'msie'],	
					  	start: '<table data-start=0 data-end=1><tbody><tr><td>foo<td>bar<td>baz</table>',
					   	execResult: '{<table><tbody><tr><td><s>foo</s><td><s>bar</s><td><s>baz</s></table>}' 
					},
          {   exclude: ['msie7.0', 'msie8.0'],	
              start: '{<table><tr><td>foo<td>bar<td>baz</table>}',
					   	execResult: '{<table><tr><td><s>foo</s><td><s>bar</s><td><s>baz</s></table>}' 
					},
					{  	start: 'foo<u>[bar]</u>baz',
					   	execResult: 'foo<s><u>[bar]</u></s>baz' 
					},
          {  	start: 'foo<span style=\"text-decoration: underline\">[bar]</span>baz',
					   	execResult:	'foo<s><span style=\"text-decoration:underline\">[bar]</span></s>baz' 
					},
          {  	start: '<u>foo[bar]baz</u>',
					   	execResult:	'<u>foo<s>[bar]</s>baz</u>' 
					},
          {  	start: '<u>foo[b<span style=\"color:blue\">ar]ba</span>z</u>',
					   	execResult:	'<u>foo<s>[b</s><span style=\"color:rgb(0, 0, 255)\"><s>ar]</s>ba</span>z</u>' 
					},
          {  	start: '<u>foo[b<i>ar]ba</i>z</u>',
					   	execResult:	'<u>foo<s>[b</s><i><s>ar]</s>ba</i>z</u>' 
					},
          {  	start: '<p style=\"text-decoration: underline\">foo[bar]baz</p>',
					   	execResult:	'<p style=\"text-decoration:underline\">foo<s>[bar]</s>baz</p>' 
					},
          {  	start: 'foo<s>[bar]</s>baz',
					   	execResult:	'foo[bar]baz' 
					},
          {   exclude: ['mozilla', 'msie7.0', 'msie8.0'], //mozilla & ie doesn't remove the span	
              start: 'foo<span style=\"text-decoration: line-through\">[bar]</span>baz',
					   	execResult:	'foo[bar]baz' 
					},
          {  	start: '<s>foo[bar]baz</s>',
					   	execResult:	'<s>foo</s>[bar]<s>baz</s>' 
					},
          {  	start: '<s>foo[b<span style=\"color:blue\">ar]ba</span>z</s>',
					   	execResult:	'<s>foo</s>[b<span style=\"color:rgb(0, 0, 255)\">ar]<s>ba</s></span><s>z</s>' 
					},
          {  	start: '<s>foo[b<span style=\"color:blue\" id=foo>ar]ba</span>z</s>',
					   	execResult:	'<s>foo</s>[b<span style=\"color:rgb(0, 0, 255)\" id=\"foo\">ar]<s>ba</s></span><s>z</s>' 
					},
          {  	start: '<s>foo[b<i>ar]ba</i>z</s>',
					   	execResult:	'<s>foo</s>[b<i>ar]<s>ba</s></i><s>z</s>' 
					},
          {  	start: '<p style=\"text-decoration: line-through\">foo[bar]baz</p>',
					   	execResult:	'<p><s>foo</s>[bar]<s>baz</s></p>' 
					},
          {  	start: 'foo<strike>[bar]</strike>baz',
					   	execResult:	'foo[bar]baz' 
					},
          {  	start: '<strike>foo[bar]baz</strike>',
					   	execResult:	'<s>foo</s>[bar]<s>baz</s>' 
					},
          {  	start: '<strike>foo[b<span style=\"color:blue\">ar]ba</span>z</strike>',
					   	execResult:	'<s>foo</s>[b<span style=\"color:rgb(0, 0, 255)\">ar]<s>ba</s></span><s>z</s>' 
					},
          {  	start: '<strike>foo[b<i>ar]ba</i>z</strike>',
					   	execResult:	'<s>foo</s>[b<i>ar]<s>ba</s></i><s>z</s>' 
					},
          {  	start: 'foo<ins>[bar]</ins>baz',
					   	execResult:	'foo<s><ins>[bar]</ins></s>baz' 
					},
          {  	start: '<ins>foo[bar]baz</ins>',
					   	execResult:	'<ins>foo<s>[bar]</s>baz</ins>' 
					},
          {  	start: '<ins>foo[b<span style=\"color:blue\">ar]ba</span>z</ins>',
					   	execResult:	'<ins>foo<s>[b</s><span style=\"color:rgb(0, 0, 255)\"><s>ar]</s>ba</span>z</ins>' 
					},
          {  	start: '<ins>foo[b<i>ar]ba</i>z</ins>',
					   	execResult:	'<ins>foo<s>[b</s><i><s>ar]</s>ba</i>z</ins>' 
					},
          {  	start: 'foo<del>[bar]</del>baz',
					   	execResult:	'foo<del>[bar]</del>baz' 
					},
          {  	start: '<del>foo[bar]baz</del>',
					   	execResult:	'<del>foo[bar]baz</del>' 
					},
          {  	start: '<del>foo[b<span style=\"color:blue\">ar]ba</span>z</del>',
					   	execResult:	'<del>foo[b<span style=\"color:rgb(0, 0, 255)\">ar]ba</span>z</del>' 
					},
          {  	start: '<del>foo[b<i>ar]ba</i>z</del>',
					   	execResult:	'<del>foo[b<i>ar]ba</i>z</del>' 
					},
          {  	start: 'foo<span style=\"text-decoration: underline line-through\">[bar]</span>baz',
					   	execResult:	'foo<span style=\"text-decoration:underline\">[bar]</span>baz' 
					},
          {  	start: 'foo<span style=\"text-decoration: underline line-through\">b[a]r</span>baz',
					   	execResult:	'foo<span style=\"text-decoration:underline\"><s>b</s>[a]<s>r</s></span>baz' 
					},
          {  	start: 'foo<s style=\"text-decoration: underline\">[bar]</s>baz',
					   	execResult:	'foo<s><s style=\"text-decoration:underline\">[bar]</s></s>baz' 
					},
          {  	start: 'foo<s style=\"text-decoration: underline\">b[a]r</s>baz',
					   	execResult:	'foo<s style=\"text-decoration:underline\">b<s>[a]</s>r</s>baz' 
					},
          {   exclude: ['mozilla', 'msie7.0', 'msie8.0'], //mozilla & ie doesn't remove the span	
            	start: 'foo<u style=\"text-decoration: line-through\">[bar]</u>baz',
					   	execResult:	'foo[bar]baz' 
					},
          {   exclude: ['mozilla', 'msie7.0', 'msie8.0'], //mozilla & ie doesn't change	the element
            	start: 'foo<u style=\"text-decoration: line-through\">b[a]r</u>baz',
					   	execResult:	'foo<s>b</s>[a]<s>r</s>baz' 
					},
          {  	start: 'foo<s style=\"text-decoration: overline\">[bar]</s>baz',
					   	execResult:	'foo<s><s style=\"text-decoration:overline\">[bar]</s></s>baz' 
					},
          {  	start: 'foo<s style=\"text-decoration: overline\">b[a]r</s>baz',
					   	execResult:	'foo<s style=\"text-decoration:overline\">b<s>[a]</s>r</s>baz' 
					},
          {  	start: 'foo<u style=\"text-decoration: overline\">[bar]</u>baz',
					   	execResult:	'foo<s><u style=\"text-decoration:overline\">[bar]</u></s>baz' 
					},
          {  	start: 'foo<u style=\"text-decoration: overline\">b[a]r</u>baz',
					   	execResult:	'foo<u style=\"text-decoration:overline\">b<s>[a]</s>r</u>baz' 
					},
          {  	start: '<p style=\"text-decoration: line-through\">foo[bar]baz</p>',
					   	execResult:	'<p><s>foo</s>[bar]<s>baz</s></p>' 
					},
          {  	start: '<p style=\"text-decoration: overline\">foo[bar]baz</p>',
					   	execResult:	'<p style=\"text-decoration:overline\">foo<s>[bar]</s>baz</p>' 
					},
          {  	start: 'foo<span class=\"underline\">[bar]</span>baz',
					   	execResult:	'foo<s><span class=\"underline\">[bar]</span></s>baz' 
					},
          {  	start: 'foo<span class=\"underline\">b[a]r</span>baz',
					   	execResult:	'foo<span class=\"underline\">b<s>[a]</s>r</span>baz' 
					},
          {  	start: 'foo<span class=\"line-through\">[bar]</span>baz',
					   	execResult:	'foo<span class=\"line-through\">[bar]</span>baz' 
					},
          {  	start: 'foo<span class=\"line-through\">b[a]r</span>baz',
					   	execResult:	'foo<span class=\"line-through\">b[a]r</span>baz' 
					},
          {  	start: 'foo<span class=\"underline-and-line-through\">[bar]</span>baz',
					   	execResult:	'foo<span class=\"underline-and-line-through\">[bar]</span>baz' 
					},
          {  	start: 'fo[o<s>b]ar</s>baz',
					   	execResult:	'fo<s>[ob]ar</s>baz' 
					},
          {  	start: 'foo<s>ba[r</s>b]az',
					   	execResult:	'foo<s>ba[rb]</s>az' 
					},
          {  	start: 'fo[o<s>bar</s>b]az',
					   	execResult:	'fo<s>[obarb]</s>az' 
					},
          {  	start: 'foo[<s>b]ar</s>baz',
					   	execResult:	'foo[b]<s>ar</s>baz' 
					},
          {  	start: 'foo<s>ba[r</s>]baz',
					   	execResult:	'foo<s>ba</s>[r]baz' 
					},
          {  	start: 'foo[<s>bar</s>]baz',
					   	execResult:	'foo[bar]baz' 
					},
          {  	start: 'foo<s>[bar]</s>baz',
					   	execResult:	'foo[bar]baz' 
					},
          {   exclude: ['mozilla', 'msie7.0', 'msie8.0'], //mozilla & ie doesn't extend the span
            	start: 'fo[o<span style=text-decoration:line-through>b]ar</span>baz',
					   	execResult:	'fo<span style=\"text-decoration:line-through\">[ob]ar</span>baz' 
					},
          {  	start: '<strike>fo[o</strike><s>b]ar</s>',
					   	execResult:	'<s>fo</s>[ob]<s>ar</s>' 
					},
          {  	start: '<s>fo[o</s><del>b]ar</del>',
					   	execResult:	'<s>fo</s>[o<del>b]ar</del>' 
					}
          
			]
	}
	</script>
	<h1 id="qunit-header">Aloha Editor command strikethrough tests</h1>
	<h2 id="qunit-banner"></h2>
	<div id="qunit-testrunner-toolbar"></div>
	<h2 id="qunit-userAgent"></h2>
	<ol id="qunit-tests"></ol>
	<div id="qunit-fixture"></div>
	<div id="edit" style="margin:20px; border:1px solid #000000;"></div>
	<div id="logBody"></div>
	</div>
</body>
</html>
